Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export names matchers and Response from RequestsMock instances #739

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

filbranden
Copy link
Contributor

This makes it possible to import or access only RequestsMock (possibly via a pytest fixture) and still be able to easily access the matchers or assemble a Response object.

It also makes it easier to adopt pytest-responses which uses responses as the fixture variable which would conflict with an import of this module.

Add test cases that mask the existing imports and still access matchers or assemble a Response object via the RequestsMock instance.

Also recommend using pytest-responses for a pytest fixture. Rather than explaining how to roll your own in a Markdown snippet, recommend using the companion package to get a standard responses pytest fixture easily usable in test cases.

This makes it possible to import or access only RequestsMock (possibly via a pytest fixture) and still be able to easily access the matchers or assemble a Response object.

It also makes it easier to adopt pytest-responses which uses `responses` as the fixture variable which would conflict with an import of this module.

Add test cases that mask the existing imports and still access matchers or assemble a Response object via the RequestsMock instance.
Rather than explaining how to roll your own in Markdown, recommend using the companion package to get a standard `responses` pytest fixture easily usable in test cases
@filbranden
Copy link
Contributor Author

See somewhat related getsentry/pytest-responses#30 proposing some usability improvements in pytest-responses as well.

@markstory markstory merged commit c796564 into getsentry:master Oct 2, 2024
16 checks passed
@markstory
Copy link
Member

Thank you 🎉

markstory added a commit that referenced this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants